
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import path from 'path';
import postCssPxToRem from 'postcss-pxtorem';
// import Components from 'unplugin-vue-components/vite';
// import { VantResolver } from 'unplugin-vue-components/resolvers';
// https://vitejs.dev/config/

export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      '@':path.resolve(__dirname, "src"),
    },
    extensions: [".ts", ".vue", ".js", ".jsx", ".tsx"], // 导入时想要省略的扩展名列表。

  },
  css: {
    postcss: {
      plugins: [
        postCssPxToRem({
          rootValue: 37.5, // 1rem的大小

          propList: ['*'], // 需要转换的属性，这里选择全部都进行转换
        }),
      ],
    },
  },
  server: {
    proxy: {

      '/xhr': {
        //路径请求前缀 如果请求带着这个前缀 才会帮你转发
        target: 'https://m.you.163.com', //就是真正的有数据的哪台服务器地址
        changeOrigin: true,
      },
      '/sph': {
        target: 'http://sph-h5-api.atguigu.cn',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/sph/, ''), //路径重写
      },

      "/topic": {
        target: "https://m.you.163.com",//v1/know/navWap.json
        
        changeOrigin: true,
      },
      "/item": {
        target: "https://m.you.163.com", 

        changeOrigin: true,
      },
    },
  },
});
function resolve(__dirname: any, arg1: string): string {

  throw new Error('Function not implemented.');
}




